<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
		var arr = [1, 2, 3, 4];
		var sum = arr.reduce(function(prev, cur, index, arr) {
		    console.log(prev, cur, index);
		    return prev + cur;
		})
		console.log(arr, sum);
		</script>
	</body>
</html>
